package nongchang.kuaijiecaifu.com.ncapp_android.ui.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import butterknife.BindView;
import butterknife.ButterKnife;
import ezy.lite.util.ContextUtil;
import ezy.widget.view.AutofitImageView;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.adapter.ItemAdapter;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.BusinessGroupBuy;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.LifeShop;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.GoodsDetailActivity;

/**
 * Created by Administrator on 2016/4/27 0027.
 */
public class BusniessGroupBuyAdapter extends ItemAdapter<BusinessGroupBuy, BusniessGroupBuyAdapter.BusniessGroupBuyViewHolder> {
    private Context context;
    public BusniessGroupBuyAdapter(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public BusniessGroupBuyAdapter.BusniessGroupBuyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new BusniessGroupBuyViewHolder(inflate(R.layout.item_business_groupbuy, parent));
    }

    @Override
    public void onBindViewHolder(BusniessGroupBuyViewHolder holder, int position) {
        BusinessGroupBuy item=getItem(position);
        Glide.with(context).load(item.image).into(holder.imgShop);
        holder.txtTitle.setText(item.title);
        holder.txtSecondTitle.setText(item.second_title);
        holder.txtPrice.setText("￥"+item.money);
        holder.txtOncePrice.setText("￥"+item.once_money);
//        holder.txtSelled.setText("已售："+item.num);
    }

    static class BusniessGroupBuyViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.img_shop)
        AutofitImageView imgShop;
        @BindView(R.id.txt_title)
        TextView txtTitle;
        @BindView(R.id.txt_second_title)
        TextView txtSecondTitle;
        @BindView(R.id.txt_price)
        TextView txtPrice;
        @BindView(R.id.txt_once_price)
        TextView txtOncePrice;
        @BindView(R.id.btn_selled)
        TextView txtSelled;

        public BusniessGroupBuyViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }

    }
}
